/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Generation.Production.impl;

import EA_Model.IEC61970.Core.impl.CurveImpl;

import EA_Model.IEC61970.Generation.Production.Emission;
import EA_Model.IEC61970.Generation.Production.EmissionCurve;
import EA_Model.IEC61970.Generation.Production.EmissionType;
import EA_Model.IEC61970.Generation.Production.ProductionPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Emission Curve</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Generation.Production.impl.EmissionCurveImpl#getEmissionContent <em>Emission Content</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Generation.Production.impl.EmissionCurveImpl#getEmissionType <em>Emission Type</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Generation.Production.impl.EmissionCurveImpl#getIsNetGrossP <em>Is Net Gross P</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class EmissionCurveImpl extends CurveImpl implements EmissionCurve {
	/**
	 * The cached value of the '{@link #getEmissionContent() <em>Emission Content</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEmissionContent()
	 * @generated
	 * @ordered
	 */
	protected Emission emissionContent;

	/**
	 * The default value of the '{@link #getEmissionType() <em>Emission Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEmissionType()
	 * @generated
	 * @ordered
	 */
	protected static final EmissionType EMISSION_TYPE_EDEFAULT = EmissionType.SULFUR_DIOXIDE;

	/**
	 * The cached value of the '{@link #getEmissionType() <em>Emission Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEmissionType()
	 * @generated
	 * @ordered
	 */
	protected EmissionType emissionType = EMISSION_TYPE_EDEFAULT;

	/**
	 * The cached value of the '{@link #getIsNetGrossP() <em>Is Net Gross P</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIsNetGrossP()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Boolean isNetGrossP;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EmissionCurveImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ProductionPackage.Literals.EMISSION_CURVE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Emission getEmissionContent() {
		if (emissionContent != null && emissionContent.eIsProxy()) {
			InternalEObject oldEmissionContent = (InternalEObject)emissionContent;
			emissionContent = (Emission)eResolveProxy(oldEmissionContent);
			if (emissionContent != oldEmissionContent) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProductionPackage.EMISSION_CURVE__EMISSION_CONTENT, oldEmissionContent, emissionContent));
			}
		}
		return emissionContent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Emission basicGetEmissionContent() {
		return emissionContent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEmissionContent(Emission newEmissionContent) {
		Emission oldEmissionContent = emissionContent;
		emissionContent = newEmissionContent;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductionPackage.EMISSION_CURVE__EMISSION_CONTENT, oldEmissionContent, emissionContent));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EmissionType getEmissionType() {
		return emissionType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEmissionType(EmissionType newEmissionType) {
		EmissionType oldEmissionType = emissionType;
		emissionType = newEmissionType == null ? EMISSION_TYPE_EDEFAULT : newEmissionType;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductionPackage.EMISSION_CURVE__EMISSION_TYPE, oldEmissionType, emissionType));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean getIsNetGrossP() {
		if (isNetGrossP != null && isNetGrossP.eIsProxy()) {
			InternalEObject oldIsNetGrossP = (InternalEObject)isNetGrossP;
			isNetGrossP = (EA_Model.IEC61970.Domain.Boolean)eResolveProxy(oldIsNetGrossP);
			if (isNetGrossP != oldIsNetGrossP) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProductionPackage.EMISSION_CURVE__IS_NET_GROSS_P, oldIsNetGrossP, isNetGrossP));
			}
		}
		return isNetGrossP;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean basicGetIsNetGrossP() {
		return isNetGrossP;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setIsNetGrossP(EA_Model.IEC61970.Domain.Boolean newIsNetGrossP) {
		EA_Model.IEC61970.Domain.Boolean oldIsNetGrossP = isNetGrossP;
		isNetGrossP = newIsNetGrossP;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductionPackage.EMISSION_CURVE__IS_NET_GROSS_P, oldIsNetGrossP, isNetGrossP));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ProductionPackage.EMISSION_CURVE__EMISSION_CONTENT:
				if (resolve) return getEmissionContent();
				return basicGetEmissionContent();
			case ProductionPackage.EMISSION_CURVE__EMISSION_TYPE:
				return getEmissionType();
			case ProductionPackage.EMISSION_CURVE__IS_NET_GROSS_P:
				if (resolve) return getIsNetGrossP();
				return basicGetIsNetGrossP();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ProductionPackage.EMISSION_CURVE__EMISSION_CONTENT:
				setEmissionContent((Emission)newValue);
				return;
			case ProductionPackage.EMISSION_CURVE__EMISSION_TYPE:
				setEmissionType((EmissionType)newValue);
				return;
			case ProductionPackage.EMISSION_CURVE__IS_NET_GROSS_P:
				setIsNetGrossP((EA_Model.IEC61970.Domain.Boolean)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ProductionPackage.EMISSION_CURVE__EMISSION_CONTENT:
				setEmissionContent((Emission)null);
				return;
			case ProductionPackage.EMISSION_CURVE__EMISSION_TYPE:
				setEmissionType(EMISSION_TYPE_EDEFAULT);
				return;
			case ProductionPackage.EMISSION_CURVE__IS_NET_GROSS_P:
				setIsNetGrossP((EA_Model.IEC61970.Domain.Boolean)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ProductionPackage.EMISSION_CURVE__EMISSION_CONTENT:
				return emissionContent != null;
			case ProductionPackage.EMISSION_CURVE__EMISSION_TYPE:
				return emissionType != EMISSION_TYPE_EDEFAULT;
			case ProductionPackage.EMISSION_CURVE__IS_NET_GROSS_P:
				return isNetGrossP != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (emissionType: ");
		result.append(emissionType);
		result.append(')');
		return result.toString();
	}

} //EmissionCurveImpl
